package com.beiing.tianshuai.tianshuai.mine.presenter;

import com.beiing.tianshuai.tianshuai.base.BasePresenter;
import com.beiing.tianshuai.tianshuai.entity.PersonalActivityBean;
import com.beiing.tianshuai.tianshuai.mine.model.PersonalActivityModel;
import com.beiing.tianshuai.tianshuai.mine.model.PersonalActivityModelImpl;
import com.beiing.tianshuai.tianshuai.mine.view.PersonalActivityViewImpl;
import com.beiing.tianshuai.tianshuai.util.LogUtils;

/**
 * Created by Jinni on 2017/7/28 0028.
 */

public class PersonalActivityPresenter extends BasePresenter implements PersonalActivityPresenterImpl, PersonalActivityModel.OnRequestListener{

    private PersonalActivityModelImpl mModel;
    private PersonalActivityViewImpl mView;

    public PersonalActivityPresenter(PersonalActivityViewImpl view) {
        mView = view;
        mModel = new PersonalActivityModel(this);
    }

    @Override
    public void getPersonalActivityResult(String uid) {
        mView.showProgress();
        mModel.getPersonalActivityResult(uid);
    }

    @Override
    public void onSuccess(PersonalActivityBean bean) {
        mView.hideProgress();
        mView.onRequestSuccess(bean);
    }

    @Override
    public void onError(Throwable throwable) {
        mView.hideProgress();
        mView.onRequestFailed(throwable);
        LogUtils.e(throwable.toString(),"error");
    }
}
